package com.situ.web.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;

@WebServlet("/setCookie")
public class SetCookieServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("SetCookieServlet.service");
        Cookie cookie1 = new Cookie("goods", "IPhone1");
        Cookie cookie2 = new Cookie("name", "IPhone2");
        //cookie1.setMaxAge(10 * 60);//保存10分钟
        resp.addCookie(cookie1);
        resp.addCookie(cookie2);
        HttpSession session = req.getSession();

    }
}
